package com.katze.boot.web.controller;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.katze.boot.plugins.security.annotations.RestControllerMapping;
import com.katze.boot.plugins.security.annotations.RestRequestMapping;
import com.katze.common.Message;
import jakarta.annotation.Resource;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Map;

@RestControllerMapping("/weather")
public class WeatherController {

    @Resource
    private ObjectMapper mapper;

    @RestRequestMapping(permits = "weather:view", description = "查看天气预报")
    public Message queryWeather(String areaId) throws IOException, URISyntaxException {
//        String data = Requester.getInstance().init(GlobalConstant.MEIZU_WEATHER_URL + "?cityIds=" + areaId).send(RequestMethod.POST);
        return Message.ok().data(mapper.readValue("", new TypeReference<Map<Object, Object>>() {}));
    }
}
